package com.baizhi.service.impl;

import com.baizhi.dao.CmfzArticleDao;
import com.baizhi.entity.CmfzArticle;
import com.baizhi.service.CmfzArticleService;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service
@Transactional
public class CmfzArticleServiceImpl implements CmfzArticleService {
    @Autowired
    private CmfzArticleDao cad;
    @Override
    public Page<CmfzArticle> selectByPage(int pageNo, int pageSize) {
        Page<CmfzArticle> cmfzArticlePage =new Page<>(pageNo,pageSize);
        Page<CmfzArticle> cmfzArticlePage1 = cad.selectPage(cmfzArticlePage, null);


        return cmfzArticlePage1;
    }

    @Override
    public void update(CmfzArticle cmfzArticle) {
            cad.updateById(cmfzArticle);
    }

    /**
     *删除一个文章
     * @param id
     */
    @Override
    public void delete(int id) {
        cad.deleteById(id);
    }
}
